<?php
// Setting the page title.
if (isset($pagetitle))
	$main_page_title = $pagetitle . ' | Money Manager 2';
else
	$main_page_title = 'Welcome to Money Manager 2';
  
// Giving more space if sidebar is not set
if (isset($sidebar)) {
  $main_container = 'span9';
  $sidebar_container = 'span3';
}
else {
  $main_container = 'span12';
  $sidebar_container = '';
}
?>
<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<title><?php print $main_page_title; ?></title>
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta name="description" content="">

		<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
		<!--[if lt IE 9]>
			<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
		<![endif]-->

		<!-- Adding the styles -->
		<link href="<?php print base_url(); ?>css/bootstrap.min.css" rel="stylesheet">
		<!-- <link href="<?php print base_url(); ?>css/ubuntu.min.css" rel="stylesheet"> -->
		<link href="<?php print base_url(); ?>css/jquery-ui.css" rel="stylesheet">
		<style type="text/css">
			body {
				padding-top: 60px;
				padding-bottom: 40px;
			}
			.sidebar-nav {
				padding: 9px 0;
			}
			@media screen and (max-width: 800px) {
				body {
					padding-top: 0px;
				}
			}
		</style>

		<!-- Including the scripts -->
		<script type="text/javascript" src="<?php print base_url(); ?>lib/jquery/jquery-min.js"></script>
		<script type="text/javascript">
			var base_url = '<?php print base_url(); ?>index.php?/';
		</script>

	</head>

	<body>
		<?php
		// This will happen only when the top_navigation is explicitly set to false.
		if (!isset($no_nav)) {
			$this->load->view('top_navigation');
		}
		?>

		<div class="container">

			<div class="row"> <!-- row start -->

				<!-- Content container starts -->
				<div class="<?php print $main_container; ?>">
                    <div class="message-container"><?php get_message(); ?></div>
					<?php if (isset($subheading)): ?>
						<h2><?php print $subheading; ?></h2>
					<?php endif; ?>
					<?php if (isset($viewname) && $viewdata): ?>
						<div id="wrapper-<?php print substr($viewname, 0, -4); ?>" class="wrapper wrapper-<?php print substr($viewname, 0, -4); ?>"><?php $this->load->view($viewname, $viewdata); ?></div>
					<?php else: ?>
						<div id="wrapper-<?php print substr($viewname, 0, -4); ?>" class="wrapper wrapper-<?php print substr($viewname, 0, -4); ?>"><?php $this->load->view($viewname); ?></div>
					<?php endif; ?>
				</div>
				<!-- Content container ends -->

				<!-- Sidebar starts -->
				<div class="<?php print $sidebar_container; ?>">
					<?php if(isset($sidebar)): ?>
					<?php $this->load->view('includes/sidebar'); ?>
					<?php endif; ?>
				</div>
				<!-- Sidebar ends -->

			</div> <!-- row ends -->
		</div>

	<!-- Adding the script -->

	<script type="text/javascript" src="<?php print base_path(); ?>js/bootstrap.min.js"></script>
	<script type="text/javascript" src="http://code.jquery.com/ui/1.9.0/jquery-ui.js"></script>
	<script type="text/javascript" src="<?php print base_path(); ?>lib/angular/angular.min.js"></script>
	<!-- For looping all the scripts passed through the controller. -->
	<?php if (isset($scripts)): ?>
		<?php foreach ($scripts as $key=>$value): ?>
			<script type="text/javascript" src="<?php print base_url(); ?>js/<?php print $value; ?>/<?php print $key; ?>.js"></script>
		<?php endforeach; ?>
	<?php endif; ?>

	</body>
</html>
